package com.hm.rabitmq.auto;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author shishun.wang
 * @date 2016年12月13日 下午4:03:04
 * @version 1.0
 * @describe
 */
@Configuration
public class RabitmqclientConfiguration {

	@Bean
	public Queue helloQueue() {
		//持久化消息
		return new Queue("hello",true);
	}
	
	@Bean
	public Queue helloRpcQueue() {
		Queue queue = new Queue("TEST_SCHEDULE_REMOTE_MQ_TASK");
		return queue;
	}
	
	@Bean
    public Queue BMessage() {
        return new Queue("fanout.B");
    }
	
	@Bean
    public Queue AMessage() {
        return new Queue("fanout.A");
    }
	
	@Bean
	public FanoutExchange fanoutExchange() {
		return new FanoutExchange("TEST_SCHEDULE_REMOTE_MQ_MUCH_TASK");
	}
	
	@Bean
	public Binding bindingExchangeB(Queue BMessage,FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(BMessage).to(fanoutExchange);
    }
	
	@Bean
	public Binding bindingExchangeA(Queue AMessage,FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(AMessage).to(fanoutExchange);
    }
}
